/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Cell, Table, TableBody, TableRow, Text,} from "customize-easy-ui-component";
import { DirectLink } from "../../../routing/Link";
import {useThreeColumnView} from "../../hook/useThreeColumnSubr";
import {config设备概况} from "./orcBase";
import {CCellUnit} from "../../common/base";

export const 结论报告概况= ({ orc, rep,theme } : { orc: any, rep: any,theme:any}
) => {
  const [firstNode,secNode]=useThreeColumnView({orc, config:config设备概况,slash:true,split:[10],
    embedCol: [undefined, <CCell rowSpan={4}>性能参数</CCell>]
  });
  return <>
    <Text id={'Conclusion'} variant="h2" css={{
      textAlign: 'center', "@media print": {pageBreakBefore: 'always',},
    }}>定期检验结论报告</Text>
    <div css={{display: 'flex', justifyContent: 'space-between'}}>
      <Text>使用证号：{orc?.使用证号}</Text>
      <Text>报告编号：{rep.isp?.no}</Text>
    </div>
    <Table fixed={["14%", "19%", "20%", "14.1%", "16%", "%"]} css={{borderCollapse: 'collapse'}} tight miniw={800}>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          {firstNode}
        </DirectLink>
      </TableBody>
    </Table>
    <Table fixed={["4%", "15.9%", "17%", "20%", "12.1%", "14%", "%"]} css={{borderCollapse: 'collapse'}} tight
           miniw={800}>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          {secNode}
        </DirectLink>
      </TableBody>
    </Table>
    <Table fixed={["7%", "15%", "34%", "16%", "%"]} css={{borderCollapse: 'collapse'}} tight miniw={800}>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Survey#Survey`}>
          <TableRow>
            <CCell>检验依据</CCell>
            <CCell colSpan={4}>
              《固定式压力容器安全技术监察规程》TSG 21-2016<br/>
              《气瓶安全技术规程》TSG 23-2021
            </CCell>
          </TableRow>
        </DirectLink>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Conclusion#Conclusion`}>
          <TableRow>
            <CCell>问题及其处理</CCell>
            <Cell split={true} colSpan={4}>
              <div css={{minHeight: '3rem', whiteSpace: 'pre-wrap'}}>
                {orc.问题及处 || '／'}
              </div>
            </Cell>
          </TableRow>
        </DirectLink>
      </TableBody>
    </Table>
    <Table  fixed={  ["7%","26%","22%","19%","%"]  } css={ {borderCollapse: 'collapse' } } tight  miniw={800}>
      <TableBody>
        <DirectLink  href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Conclusion#Conclusion`}>
          <TableRow css={{"@media print": {pageBreakInside: 'avoid',}}}>
            <CCell rowSpan={3}>检查结论</CCell>
            <CCell rowSpan={2}><Text variant="h4">{orc.检验结论}</Text></CCell>
            <CCell colSpan={3}>允许(监控)使用参数</CCell>
          </TableRow>
          <TableRow>
            <CCell colSpan={3} css={{padding:0}}>
              <Table  fixed={ ["9%","37%","9%","%"]  } css={ {borderCollapse: 'collapse', height:'fill-available'} } tight  miniw={800}>
                <TableBody>
                  <TableRow >
                    <CCell>压力</CCell>
                    <CCellUnit unit={'MPa'} >{orc.结论压力 || '／'}</CCellUnit>
                    <CCell>温度</CCell>
                    <CCellUnit unit={'℃'} >{orc.结论温度 || '／'}</CCellUnit>
                  </TableRow>
                  <TableRow >
                    <CCell>介质</CCell>
                    <CCell >{orc.结论介质}</CCell>
                    <CCell>其它</CCell>
                    <CCell >{orc.结论其它}</CCell>
                  </TableRow>
                </TableBody>
              </Table>
            </CCell>
          </TableRow>
          <TableRow>
            <CCell colSpan={2}>下次定期检验日期</CCell>
            <CCell colSpan={2}>{orc.新下检日}</CCell>
          </TableRow>
          <TableRow>
            <CCell >说明</CCell>
            <Cell split={true} colSpan={4}><div css={{minHeight: '2rem', whiteSpace: 'pre-wrap'}}>
              {orc.结论说明 || '／'}
            </div></Cell>
          </TableRow>
        </DirectLink>
      </TableBody>
    </Table>
  </>;
};
